const mongoose = require('mongoose');

const { Schema, model } = mongoose;
const handAccountSchema = new Schema({
  __v: { type: Number, select: false },
  owner: { type: Schema.Types.ObjectId, ref: 'User', required: true},
  topic: { type: Schema.Types.ObjectId, ref: 'Topic' },
  title: { type: String, required: true }, 
  content: { type: String, required: true }, // * 现在存的是json字符串
  // img_url: {type: String},
  isOpen: { type: Boolean },
  voteCount: { type: Number, required: true, default: 0 }, // 点赞数
  createdAt: {type: String, select: false},
  updatedAt: {type: String, select: false}
}, { timestamps: true });

module.exports = model('HandAccount', handAccountSchema);